<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>拉起小程序</title>
        <style>
            .button {
                border: 1px solid green;
                background: rgb(8, 106, 8);
                color: white;
                font-weight: bold;
                width: 180px;
                padding: 20px;
                text-align: center;
                border-radius: 5px;
                margin-bottom: 10px;
            }

            a {
                color: white;
                text-decoration: none;
            }
        </style>
    </head>
    <body>

        <div class="button t1">
            <a class="a1">故障申报</a>
        </div>

        <div class="button t2">
            <a class="a2">ym_test</a>
        </div>
        <script src="jquery.js"></script>
        <script>
            $(function() {
                let env = check()
                let url = [{
                        "url": "weixin://dl/business/?t=6uxWYyFSLBs"
                    },
                    {
                        "url": "weixin://dl/business/?t=61ybtRJpros"
                    }
                ]
                if ("android" == env) {
                    $('.t1').on('click', function() {
                        console.log('android t1 click')
                        location.href = url[0].url
                        //$('.a1').attr({ "href": url[0].url })
                    })

                    $('.t2').on('click', function() {
                        console.log('android t2 click')
                        location.href = url[1].url
                        //$('.a1').attr({ "href": url[1].url })
                    })

                } else if ("ios" == env) {
                    $('.t1').on('click', function() {
                        console.log('ios t1 click')
                        $('.a1').attr({
                            "href": url[0].url
                        })
                    })

                    $('.t2').on('click', function() {
                        console.log('ios t2 click')
                        $('.a2').attr({
                            "href": url[1].url
                        })

                    })

                } else if ("pc" == env) {
                    console.log(o);
                }
            })

            function check() {
                let u = navigator.userAgent,
                    app = navigator.appVersion;
                if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) {
                    return 'android';
                } else if (!!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) {
                    return 'ios';
                } else {
                    return 'pc';
                }
            }
        </script>
    </body>
</html>